package BitManipulation;

public class _476_NumberComplement {
    public int findComplement(int num) {
        if (num == 0) {
            return 1;
        }
        int count = 0;
        int power = 1;
        while (num != 0) {
            if ((num & 1) == 0) {
                count += power;
            }
            power *=2;
            num = num >> 1;
        }
        return count;
    }
}
